﻿using System;
using System.Linq;
using WebExam.DataEntities;

namespace WebExam.DataProvider
{
    public interface ISTKRepository
    {
        /// <summary>
        /// 获取试题
        /// </summary>
        /// <param name="start">开始位置</param>
        /// <param name="takeSize">获取条数</param>
        IQueryable<STK> GetAll(int start, int takeSize);

        /// <summary>
        /// 获取指定题型下的试题
        /// </summary>
        /// <param name="txId">题型Id</param>
        /// <param name="start">开始位置</param>
        /// <param name="takeSize">获取条数</param>
        IQueryable<STK> GetAll(int txId,int start, int takeSize);

        /// <summary>
        /// 获取试题
        /// </summary>
        /// <param name="stId">试题Id</param>
        STK Get(int stId);

        /// <summary>
        /// 添加试题
        /// </summary>
        /// <param name="st">试题对象</param>
        STK Add(STK st);

        /// <summary>
        /// 更新试题
        /// </summary>
        /// <param name="stId">试题Id</param>
        /// <param name="update">包含更新操作的方法</param>
        STK Update(int stId, Action<STK> update);

        /// <summary>
        /// 删除试题
        /// </summary>
        /// <param name="stId">试题Id</param>
        bool Delete(int stId);

        /// <summary>
        /// 指定题型下是否存在同名试题
        /// </summary>
        /// <param name="txId">题型Id</param>
        /// <param name="stName">试题名称</param>
        bool IsExists(int txId, string stName);

        /// <summary>
        /// 统计试题条数
        /// </summary>
        int Count();

        /// <summary>
        /// 统计指定题型下的试题条数
        /// </summary>
        /// <param name="txId">题型Id</param>
        int Count(int txId);
    }
}